package com.xhh.nphm.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhh.nphm.common.core.domain.entity.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DeptMapper extends BaseMapper<Dept> {
    /**
     * 查询派发单位列表
     * @return
     */
    @Select("select NoUnit,DeptShort from bUserDept where AreaNo=5101 and UseState=1 and len(NoUnit)=len(304) and isDel=0 order by OrdNum")
    List<Map<String,String>> selectDistribute();

    /**
     * 查询派发单位下级列表
     * @return
     */
    @Select("select NoUnit,DeptShort from bUserDept where UseState=1 and NoParent=304 and isDel=0 order by OrdNum")
    List<Map<String, String>> selectSltDept();

    /**
     * 2023/1/11
     * 根据部门名称查询部门信息
     * @return
     */
    @Select("select * from bUserDept where UseState=1  and isDel=0 and DeptName=#{deptName} order by OrdNum")
    Dept selectDeptByDeptName(String deptName);

}
